<template>
  <div class="home">
    <div class="main-content">
      <div class="banner">
        <h1>您的健康，我们的关注</h1>
        <p>专业的医药服务，贴心的健康管理</p>
      </div>
      <el-row :gutter="30" class="features-section">
        <el-col :span="8" v-for="(feature, index) in features" :key="index">
          <el-card class="feature-card" :body-style="{ padding: '0px' }">
            <div class="feature-icon">
              <el-icon>
                <component :is="feature.icon" />
              </el-icon>
            </div>
            <div class="feature-content">
              <h3>{{ feature.title }}</h3>
              <p>{{ feature.description }}</p>
              <el-button type="primary" plain @click="$router.push(feature.route)">
                立即体验
              </el-button>
            </div>
          </el-card>
        </el-col>
      </el-row>
      <div class="advantages-section">
        <h2>我们的优势</h2>
        <el-row :gutter="20">
          <el-col :span="6" v-for="(advantage, index) in advantages" :key="index">
            <div class="advantage-item">
              <el-icon>
                <component :is="advantage.icon" />
              </el-icon>
              <h4>{{ advantage.title }}</h4>
              <p>{{ advantage.description }}</p>
            </div>
          </el-col>
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
import {
  ShoppingBag,
  Reading,
  Service,
  Check,
  User,
  Van
} from '@element-plus/icons-vue'

export default {
  name: 'Home',
  setup() {
    const features = [
      {
        title: '药品商城',
        description: '正品保障，品类齐全，快速配送到家',
        icon: ShoppingBag,
        route: '/medicines'
      },
      {
        title: '养生知识',
        description: '专业的养生保健知识，助您健康生活',
        icon: Reading,
        route: '/health'
      },
      {
        title: '健康咨询',
        description: '专业医生在线问诊，贴心服务',
        icon: Service,
        route: '/consultation'
      }
    ]
    const advantages = [
      {
        title: '正品保障',
        description: '严格的药品质量把控',
        icon: Check
      },
      {
        title: '专业服务',
        description: '专业的医师团队',
        icon: User
      },
      {
        title: '快速配送',
        description: '24小时内送达',
        icon: Van
      },
      {
        title: '售后无忧',
        description: '7天无理由退换',
        icon: Service
      }
    ]
    return {
      features,
      advantages
    }
  }
}
</script>

<style scoped>
.home {
  min-height: 100vh;
  background: #f5f7fa;
}
.main-content {
  margin-top: 40px;
  padding: 40px 20px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.banner {
  text-align: center;
  padding: 60px 0;
  background: linear-gradient(135deg, #e6f7ff 0%, #ffffff 100%);
  border-radius: 8px;
  margin-bottom: 40px;
}
.banner h1 {
  font-size: 36px;
  color: #303133;
  margin-bottom: 20px;
}
.banner p {
  font-size: 18px;
  color: #606266;
}
.features-section {
  margin-bottom: 60px;
}
.feature-card {
  height: 100%;
  transition: all 0.3s ease;
  border-radius: 8px;
  overflow: hidden;
}
.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}
.feature-icon {
  background: linear-gradient(135deg, #409EFF 0%, #36cfc9 100%);
  padding: 30px;
  text-align: center;
}
.feature-icon .el-icon {
  font-size: 40px;
  color: #fff;
}
.feature-content {
  padding: 20px;
  text-align: center;
}
.feature-content h3 {
  font-size: 20px;
  color: #303133;
  margin-bottom: 10px;
}
.feature-content p {
  color: #606266;
  margin-bottom: 20px;
}
.advantages-section {
  padding: 60px 0;
  background: #fff;
  border-radius: 8px;
}
.advantages-section h2 {
  text-align: center;
  font-size: 28px;
  color: #303133;
  margin-bottom: 40px;
}
.advantage-item {
  text-align: center;
  padding: 20px;
}
.advantage-item .el-icon {
  font-size: 36px;
  color: #409EFF;
  margin-bottom: 15px;
}
.advantage-item h4 {
  font-size: 18px;
  color: #303133;
  margin-bottom: 10px;
}
.advantage-item p {
  color: #606266;
}
</style> 